﻿<!DOCTYPE html>
<html>

<head>
    <title>THCView.DoSectionDrawItemPaintAfter(THCCustomData,Integer,TRect,Integer,Integer,Integer,Integer,TCanvas,TPaintInfo) Method</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta name="generator" content="Documentation Insight" />
    <base target="_self" />
    <link type="text/css" rel="Stylesheet" href="css/presentation.css" />
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery.cookie.js"></script>
    <script type="text/javascript" src="js/di.js"></script>
    <style type="text/css">
        .tabHead {
            float: left;
            padding-left: 2px;
        }

        .active {
            background-color: #f8f8f8;
        }

        .disActive {
            background-color: #939393;
            border-bottom: solid 1px #939393;
        }

        .tabHead :hover {
            background-color: bisque;
            cursor: pointer;
        }

        .unActive {
            display: none;
        }

    </style>
    <script type="text/javascript" src="js/jquery-migrate.min.js"></script>
    <!--[if (!IE) | (gt IE 8)]><!-->
    <link type='text/css' rel='Stylesheet' href='css/highlighter.css' />
    <!--<![endif]-->
    <!--[if (!IE) | (gt IE 8)]><!-->
    <script src="js/highlight.min.js"></script>
    <!--<![endif]-->
    <script type="text/javascript">
        if (($.browser.msie == undefined) || ($.browser.version > 8)) {
            hljs.tabReplace = '  ';
            $(document).ready(function() {
                $("#footerContent").html(getCopyright());

                $('pre').each(function(i, e) {
                    hljs.highlightBlock(e);
                });
            });
        }

    </script>
    <script type="text/javascript">
        if (top.frames.length == 0) {
            var topicUrl = top.location.href.substring(top.location.href.lastIndexOf("/") + 1, top.location.href.length);
            var regex = new RegExp('(mk:@MSITStore|ms-help):?', 'i')
            if (!top.location.href.match(regex)) {
                top.location.href = "index.htm?" + topicUrl;
            }
        } else if (top && top.navigationFrame && top.navigationFrame.selectTocItem) {
            top.navigationFrame.selectTocItem("HCView.THCView.DoSectionDrawItemPaintAfter(THCCustomData,Integer,TRect,Integer,Integer,Integer,Integer,TCanvas,TPaintInfo)");
        };

    </script>
    <script type="text/javascript">
        var tempId = "Delphi";
        $(document).ready(function() {
            $(".codeSnippetTabActive").on("click", function() {
                var obj = $(this);
                var id = obj.attr("data-lbl");
                $(".codeSnippetTabActive").removeClass("active");
                $(".codeSnippetTabActive").addClass("disActive");
                obj.removeClass("disActive");
                obj.addClass("active");
                $("#" + tempId).addClass("unActive");
                $("#" + id).removeClass("unActive");
                tempId = id;
            });
        });

    </script>
</head>

<body class="library">
    <input type="hidden" id="contentEditableControl" class="userDataStyle" value="false" />
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <input type="hidden" id="moduleName" value="HCEmrView" />
    <input type="hidden" id="elementId" value="HCView.THCView.DoSectionDrawItemPaintAfter(THCCustomData,Integer,TRect,Integer,Integer,Integer,Integer,TCanvas,TPaintInfo)" />
    <div id="content">
        <div class="topic">
            <h2 class="title">加载文件</h2>
            <h3>加载磁盘文件或二进制流文件，如果你保存时有对文件进行压缩操作，需要先解压数据再调用加载方法。</h3>
            <div id="mainSection">
                <div id="mainBody">
                    <div id="summarySection" class="section">
                        <input class="tagName" type="hidden" value="summary" />
                        <div id="summaryHeader" class="sectionHeader">
                            <div>
                                <a href="javascript:void(0)" class="collapsibleAreaHref" title="Collapse">
                                    <span class="collapsibleAreaIcon collapsibleAreaExpanding">
                                        <!---->
                                    </span>
                                    <span class="collapsibleAreaTitle">Summary</span>
                                </a>
                            </div>
                        </div>
                    </div><br />
                    <div id="syntaxSection" class="section">
                        <div id="syntaxHeader" class="sectionHeader">
                            <div>
                                <a href="javascript:void(0)" class="collapsibleAreaHref" title="Collapse">
                                    <span class="collapsibleAreaIcon collapsibleAreaExpanding">
                                        <!---->
                                    </span>
                                    <span class="collapsibleAreaTitle">参考</span>
                                </a>
                            </div>
                        </div>
                        <div id="syntaxContent" class="sectionContent" contentEditable="false">
                            <div class="codeSnippet" contentEditable="false"><input class="code" type="hidden" value="" />
                                <div class="codeSnippetTabs tabHead">
                                    <div class="codeSnippetTabActive active" data-lbl="Delphi"><a>Delphi</a></div>
                                </div>
                                <div class="codeSnippetTabs tabHead">
                                    <div class="codeSnippetTabActive disActive" data-lbl="CSharp"><a>C#</a></div>
                                </div>
                                <div class="codeSnippetCodeContainer tabs" id="Delphi">
                                    <div class="codeSnippetCode">
                                        <h4 class="subHeading">加载文件流</h4>
                                        <dl>
                                            <pre class="delphi" contentEditable="false">
procedure GetTemplateContent(const ATempID: Cardinal; const AStream: TStream);
begin
  BLLServerExec(
    procedure(const ABLLServerReady: TBLLServerProxy)
    begin
      ABLLServerReady.Cmd := BLL_GETTEMPLATECONTENT;  // 获取模板分组子分组和模板
      ABLLServerReady.ExecParam.I['TID'] := ATempID;
      ABLLServerReady.AddBackField('content');
    end,
    procedure(const ABLLServer: TBLLServerProxy; const AMemTable: TFDMemTable = nil)
    begin
      if not ABLLServer.MethodRunOk then  // 服务端方法返回执行不成功
        raise Exception.Create(ABLLServer.MethodError);

      ABLLServer.BackField('content').SaveBinaryToStream(AStream);
      
      if AStream.Size > 0 then
        vFrmRecord.EmrView.LoadFromStream(vSM);
    end);
end;
</pre>
                                        </dl>
                                        <h4 class="subHeading">打开文件，支持.hcf、xml、docx</h4>
                                        <dl>
                                            <pre class="delphi" contentEditable="false">
procedure TfrmRecord.mniOpenClick(Sender: TObject);
var
  vOpenDlg: TOpenDialog;
begin
  if FEmrView.ReadOnly then
  begin
    ShowMessage('当前文档只读！');
    Exit;
  end;

  vOpenDlg := TOpenDialog.Create(Self);
  try
    vOpenDlg.Filter := '文件|*' + HC_EXT;
    if vOpenDlg.Execute then
    begin
      if vOpenDlg.FileName <> '' then
        FEmrView.LoadFromFile(vOpenDlg.FileName);
    end;
  finally
    FreeAndNil(vOpenDlg);
  end;
end;                                            
                                            </pre>
                                        </dl>
                                    </div>
                                </div>
                                <div class="codeSnippetCodeContainer tabs unActive" id="CSharp">
                                    <div class="codeSnippetCode">
                                        <h4 class="subHeading">加载文件流</h4>
                                        <dl>
                                            <pre class="CSharp" contentEditable="false">
public void GetTemplateContent(int aTempID, Stream aStream)
{
    DataTable dt = FDB.GetData(string.Format(Sql_GetTemplateContent, (aTempID)));
    if (dt.Rows.Count > 0)
    {
        if (dt.Rows[0]["content"].GetType() != typeof(System.DBNull))
        {
            byte[] vContent = (byte[])dt.Rows[0]["content"];
            aStream.Write(vContent, 0, vContent.Length);
            
            if (aStream.Length > 0)
                vFrmRecord.EmrView.LoadFromStream(aStream);
        }
    }
}
</pre>
                                        </dl>
                                        <h4 class="subHeading">加载文件，支持.hcf、xml</h4>
                                        <dl>
                                            <pre class="CSharp" contentEditable="false">
private void mniOpen_Click(object sender, EventArgs e)
{
    OpenFileDialog vOpenDlg = new OpenFileDialog();
    try
    {
        vOpenDlg.Filter = "文件|*" + HC.View.HC.HC_EXT;
        if (vOpenDlg.ShowDialog() == DialogResult.OK)
        {
            if (vOpenDlg.FileName != "")
            {
                Application.DoEvents();
                FHCView.LoadFromFile(vOpenDlg.FileName);
            }
        }
    }
    finally
    {
        vOpenDlg.Dispose();
        GC.Collect();
    }
}
                                            </pre>
                                        </dl>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div id="seealsoSection" class="section">
                        <input class="tagName" type="hidden" value="seealso" />
                        <div id="seealsoHeader" class="sectionHeader">
                            <div>
                                <a href="javascript:void(0)" class="collapsibleAreaHref" title="Collapse">
                                    <span class="collapsibleAreaIcon collapsibleAreaExpanding">
                                        <!---->
                                    </span>
                                    <span class="collapsibleAreaTitle">查看</span>
                                </a>
                            </div>
                        </div>
                        <div id="seealsoContent" class="sectionContent" contentEditable="false">
                            <ul class="seeAlsoCodeReference">
                                <li><a href="HCEmrView_Property.htm" title="HCEmrView属性">HCEmrView属性</a></li>
                                <li><a href="HCEmrView_Method.htm" title="HCEmrView方法">HCEmrView方法</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="footer">
        <div id="footerContent"></div>
    </div>
</body>

</html>
